package com.ai.platform.model.dto;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by yeyingsheng on 2018/4/23.
 * 入参封装
 */
public class Input implements java.io.Serializable{

    private String serviceName;

    private String method;

    private String ip;

    private Map<String,String[]> inputMap=new HashMap<>();

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public void addInputMap(Map<String, String[]> inputMap) {
        this.inputMap.putAll(inputMap);
    }

    public String getValue(String key){
        String[] values=getValues(key);
        return (null==values || values.length==0)?null:values[0];
    }

    public String[] getValues(String key){
        String[] values=inputMap.get(key);
        return values;
    }

    public void putValue(String key,String ...values){
       if(null!=values && values.length>0){
           String[] strings=new String[values.length];
           for (int i=0;i<values.length;i++){
               strings[i]=values[i];
           }
           this.getInputMap().put(key,strings);
       }
    }

    public Input() {
    }

    public Input(String serviceName, String method, Map<String, String[]> inputMap) {
        this.serviceName = serviceName;
        this.method = method;
        this.inputMap = inputMap;
    }

    public Input(String serviceName, String method) {
        this.serviceName = serviceName;
        this.method = method;
    }

    public Input(String serviceName, String method,Object obj) {
        this.serviceName = serviceName;
        this.method = method;
    }

    public Map<String, String[]> getInputMap() {
        return inputMap;
    }

    public void setInputMap(Map<String, String[]> inputMap) {
        this.inputMap = inputMap;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }
}
